/*
 * File Created: 2019-11-28 22:30:33
 * Author: 余保林 (yubaolin6@outlook.com)
 * Desc: 品牌管理相关接口
 * Last Modified: 2019-11-30 16:20:03
 * Modified By: 余保林 (yubaolin6@outlook.com>)
 */

import request from '@/utils/request'

/**
 * 查询所有品牌信息
 * @param {*} params
 */
export function brandQuery() {
  return request.get(`/platform/brand`)
}

/**
 * 品牌新增
 */
export function brandAdd(data) {
  return request.post('/platform/brands', data)
}

/**
 * 品牌详情
 * @param {*} id
 */
export function brandDetail(id) {
  return request.get(`/platform/brands/${id}`)
}

/**
 * 编辑品牌信息
 * @param {*} data
 */
export function brandEdit(data) {
  return request.patch(`/platform/brands/${data.id}`, data)
}

/**
 * 禁用品牌
 * @param {*} id
 */
export function brandDisable(id) {
  return request.patch(`/platform/brands/${id}/disable`)
}

/**
 * 启用品牌
 * @param {*} id
 */
export function brandEnable(id) {
  return request.patch(`/platform/brands/${id}/enable`)
}

/**
 * 所有启用的品牌信息
 */
export function enableBrands() {
  return request.get(`/platform/brand/enables`)
}

/**
 * 所有启用的品牌信息
 */
export function enableBrandsByName(name = '') {
  return request.get(`/platform/brand/names/enable?name=${name}`)
}

export const uploadBrandUrl = '/platform/brand/logo/upload';